//
//  UILabel+Chain.m
//  ditelMaintain
//
//  Created by 葛悦彣 on 2023/3/2.
//

#import "UILabel+Chain.h"

@implementation UILabel (Chain)

-(UILabel * _Nonnull (^)(NSString * _Nonnull))addText {
    return ^(NSString * text){
        self.text = text;
        return self;
    };
}
- (UILabel * _Nonnull (^)(UIFont * _Nonnull))addFont {
    return ^(UIFont * font){
        self.font = font;
        return self;
    };
}
- (UILabel * _Nonnull (^)(UIColor * _Nonnull))addTextColor{
    return ^(UIColor * color){
        self.textColor = color;
        return self;
    };
}

- (UILabel * _Nonnull (^)(NSInteger))addNumberOfLines{
    return ^(NSInteger numberOfLines){
        self.numberOfLines = numberOfLines;
        return self;
    };
}
+(UILabel * _Nonnull (^)(void))newLab{
    return ^(){
        return [UILabel new];
    };
}

- (UILabel * _Nonnull (^)(void))mas_KLS{
    return ^(){
        ///抗拉伸
        [self setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
        return self;
    };
}
- (UILabel * _Nonnull (^)(void))mas_KYS{
    return ^(){
        ///抗被压缩
        [self setContentCompressionResistancePriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
        return self;
    };
}
- (UILabel * _Nonnull (^)(UIColor * _Nonnull))addbackgroundColor{
    return ^(UIColor * color){
        self.backgroundColor = color;
        return self;
    };
}
@end
